package com.qs.eggs.view.prodetail.fragment;

import android.os.Bundle;
import android.view.View;

import com.google.gson.reflect.TypeToken;
import com.qs.eggs.api.HttpApi;
import com.qs.eggs.bean.EvaluationBean;
import com.qs.eggs.refresh.adapter.BaseRecyclerAdapter;
import com.qs.eggs.refresh.fragments.BaseRecyclerViewFragment;
import com.qs.eggs.view.prodetail.adapter.EvaluationAdapter;

import java.lang.reflect.Type;
import java.util.ArrayList;

public class AllEvaluationFragment extends BaseRecyclerViewFragment<EvaluationBean> {
    private  String proid,type;
    public Bundle bundle;
    @Override
    protected BaseRecyclerAdapter<EvaluationBean> getRecyclerAdapter() {
        return new EvaluationAdapter(getActivity(), BaseRecyclerAdapter.ONLY_FOOTER);
    }
    @Override
    protected void initWidget(View root) {
        super.initWidget(root);
        proid=getActivity().getIntent().getStringExtra("proid");
        type=getActivity().getIntent().getStringExtra("type");

    }

    @Override
    public void initData() {
        super.initData();
    }

    @Override
    public void onItemClick(int position, long itemId) {
        super.onItemClick(position, itemId);
        EvaluationBean sub = mAdapter.getItem(position);

        if (sub == null)
            return;
      //  LikeDetailActivity.show(mContext, sub.getId());
    }

    @Override
    protected void requestData() {
        super.requestData();

        HttpApi.getEvaluationList(proid,type,"",mHandler);

    }


    @Override
    protected Type getType() {
        return new TypeToken<ArrayList<EvaluationBean>>() {
        }.getType();
    }
}